<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="Mosaddek">
        <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
        <link rel="shortcut icon" href="img/favicon.png">

        <title>Edit item</title>

        <!-- Bootstrap core CSS -->
        <link href="<?php echo base_url() ?>/Resources/Admin/css/bootstrap.min.css" rel="stylesheet">
        <link href="<?php echo base_url() ?>/Resources/Admin/css/bootstrap-reset.css" rel="stylesheet">
        <!--external css-->
        <link href="<?php echo base_url() ?>/Resources/Admin/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>/Resources/Admin/assets/bootstrap-wysihtml5/bootstrap-wysihtml5.css" />
        <!-- Custom styles for this template -->
        <link href="<?php echo base_url() ?>/Resources/Admin/css/style.css" rel="stylesheet">
        <link href="<?php echo base_url() ?>/Resources/Admin/css/style-responsive.css" rel="stylesheet" />
        <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
        <!--[if lt IE 9]>
          <script src="js/html5shiv.js"></script>
          <script src="js/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>

        <section id="container" class="">
            <!--header start-->
            <header class="header white-bg">
                <?php $this->load->view('admin_layout/header') ?>
            </header>
            <!--header end-->
            <!--sidebar start-->
            <aside>
                <div id="sidebar"  class="nav-collapse ">
                    <!-- sidebar menu start-->
                    <?php $this->load->view('admin_layout/sidebar') ?>
                    <!-- sidebar menu end-->
                </div>
            </aside>
            <!--sidebar end-->
            <!--main content start-->
            <section id="main-content">
                <section class="wrapper">
                    <!-- page start-->
                    <div class="row">
                        <div class="col-lg-12">
                            <section class="panel">
                                <header class="panel-heading">
                                    Edit Item
                                </header>
                                <div class="panel-body">
                                    <div class="form">
                                        <form class="cmxform form-horizontal tasi-form" id="edit_item"  method="POST" >
                                            <div class="col-lg-8">
                                                <div class="form-group ">
                                                    <label for="name" class="control-label col-lg-2">Tên Item:</label>
                                                    <div class="col-lg-10"> 
                                                        <input class=" form-control" id="name" <?php if ($item->IS_EDIT != 1) echo 'readonly' ?> name="name" type="text" value="<?php echo $item->ITEM_NAME ?>" />
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="control-label col-lg-2" for="hero_insert">Tên hero</label>
                                                    <div class="col-lg-10">      <select <?php if ($item->IS_EDIT != 1) echo 'readonly' ?> id="hero_insert" class="form-control" name="hero_insert">
                                                            <?php
                                                            if (isset($hero)) {
                                                                foreach ($hero as $he) {
                                                                    ?>
                                                                    <option value="<?php echo $he->HERO_NAME ?>" <?php if ($he->HERO_NAME == $item->HERO_NAME) echo "selected=selected"; ?> >  <?php echo $he->HERO_NAME ?></option>
                                                                <?php }
                                                            }
                                                            ?>
                                                        </select> </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="control-label col-lg-2" for="rarity_insert">Rarity</label>
                                                    <div class="col-lg-10">               <select <?php if ($item->IS_EDIT != 1) echo 'readonly' ?> class="form-control" name="rarity_insert">
                                                            <option value=""></option>
                                                            <?php
                                                            if (isset($rarity)) {
                                                                foreach ($rarity as $ra) {
                                                                    if ($ra->ITEM_RARITY != '') {
                                                                        ?>
                                                                        <option value="<?php echo $ra->ITEM_RARITY ?>" <?php if ($ra->ITEM_RARITY == $item->ITEM_RARITY) echo "selected=selected"; ?> ><?php echo $ra->ITEM_RARITY ?></option>

                                                                    <?php
                                                                    }
                                                                }
                                                            }
                                                            ?>

                                                        </select> </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="control-label col-lg-2" for="type_insert">Type</label>
                                                    <div class="col-lg-10">    <select <?php if ($item->IS_EDIT != 1) echo 'readonly' ?> class="form-control" name="type_insert">
                                                            <?php
                                                            $flag;
                                                            if (isset($type)) {
                                                                foreach ($type as $ty) {
                                                                    if ($ty->ITEM_TYPE != '') {
                                                                        if ($ty->ITEM_TYPE == "Other")
                                                                            $flag = 1;
                                                                        ?>

                                                                        <option value="<?php echo $ty->ITEM_TYPE ?>" <?php if ($ty->ITEM_TYPE == $item->ITEM_TYPE) echo "selected=selected"; ?> ><?php echo $ty->ITEM_TYPE ?></option>

        <?php
        }
    }
}
?>                                                    <?php if ($flag != 1) { ?>
                                                                <option value="Other" <?php if ($ty->ITEM_TYPE == $item->ITEM_TYPE) echo "selected=selected"; ?>>Other</option> <?php } ?>
                                                        </select> </div>
                                                </div>
                                                <div class="form-group ">
                                                    <label for="image" class="control-label col-lg-2">Image URL:</label>
                                                    <div class="col-lg-10">
                                                        <input <?php if ($item->IS_EDIT != 1) echo 'readonly' ?> class=" form-control" id="image" name="image" value="<?php echo $item->ITEM_IMAGE ?>" type="text" />
                                                    </div>
                                                </div>

                                                <div class="form-group ">
                                                    <label for="chitiet" class="control-label col-lg-2">Chi tiết:</label>
                                                    <div class="col-lg-10">
                                                        <textarea class="form-control" name="chitiet" value="<?php echo $item->DESCRIPTION ?>" id="chitiet" rows="13"></textarea>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-4">
                                                <div>
                                                    <img src="<?php echo $item->ITEM_IMAGE; ?>" style="width: 100%;max-height: 100%" />
                                                </div>
                                                <div class="form-group ">
                                                    <br />
                                                    <label for="price_market" class="control-label col-lg-2">Giá trên Market:</label>
                                                    <div class="col-lg-10">
                                                        <input disabled class="form-control" id="price_market" name="price_market" type="text" value="<?php echo $item->PRICE_MARKET ?>" />
                                                    </div>
                                                </div>

                                                <div class="form-group ">
                                                    <label for="price" class="control-label col-lg-2">Giá bán: </label>
                                                    <div class="col-lg-10">
                                                        <input class=" form-control" id="price" name="price" type="text" value="<?php echo $item->PRICE ?>" />
                                                    </div>
                                                </div>
                                                      <label>Đặt gía sale riêng </label>
                                            <input  type="checkbox" style="width: 20px" <?php if($item->IS_SALE) echo "checked='checked'" ?>  class="checkbox form-control" value="1" id="is_sale" name="is_sale" />
                                          
                                              <label>Đặt là Hot Item </label>
                                            <input  type="checkbox" style="width: 20px" <?php if($item->IS_HOT_ITEM) echo "checked='checked'" ?>  class="checkbox form-control" value="1" id="is_hot" name="is_hot" />
                                                <label>Đặt Item lên SideBar</label>
                                            <input  type="checkbox" style="width: 20px" <?php if($item->IS_SIDEBAR_ITEM) echo "checked='checked'" ?> class="checkbox form-control" value="1" id="is_sidebar" name="is_sidebar" />
                                                 <label>Đặt Item lên Slide</label>
                                            <input  type="checkbox" style="width: 20px" <?php if($item->IS_SLIDE) echo "checked='checked'" ?> class="checkbox form-control" value="1" id="is_slide" name="is_slide" />
                                            </div>

                                    </div>
                                    <div class="form-group">
                                        <div class="col-lg-offset-5 col-lg-10"> <br />
                                            <input class="btn btn-danger" type="submit" name="capnhat_item1" onClick="alert('Cập nhật Item thành công');" id="capnhat_item1"  value="Save" />
                                            <a href="<?php echo base_url('item/show_item_2') ?>"><button class="btn btn-info" type="button">Cancel</button></a>
                                        </div>
                                    </div>
                                    </form>
                                </div>
                        </div>
                </section>
                </div>
                </div>
                <!-- page end-->
            </section>
        </section>
        <!--main content end-->
        <!--footer start-->
        <footer class="site-footer">
<?php $this->load->view('admin_layout/footer') ?>
        </footer>
        <!--footer end-->
    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="<?php echo base_url() ?>/Resources/Admin/js/jquery.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="<?php echo base_url() ?>/Resources/Admin/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/jquery.scrollTo.min.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script type="text/javascript" src="<?php echo base_url() ?>/Resources/Admin/js/jquery.validate.min.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/respond.min.js" ></script>
    <script type="text/javascript" src="<?php echo base_url() ?>/Resources/Admin/assets/bootstrap-wysihtml5/bootstrap-wysihtml5.js"></script>
    <!--common script for all pages-->
    <script src="<?php echo base_url() ?>/Resources/Admin/js/common-scripts.js"></script>

    <!--script for this page-->
    <script src="<?php echo base_url() ?>/Resources/Admin/js/form-validation-script.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/advanced-form-components.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/form-component.js"></script>
    <script src="<?php echo base_url() ?>/Resources/Admin/js/bootstrap-switch.js"></script>
    <!--custom tagsinput-->
    <script src="<?php echo base_url() ?>/Resources/Admin/js/jquery.tagsinput.js"></script>
    <!--custom checkbox & radio-->
    <script type="text/javascript" src="js/ga.js"></script>
    <script src="<?php echo base_url() ?>Resources/Admin/js/common-scripts.js"></script>
                                            <script type="text/javascript">
                                                		$("#price").keydown(function (e) {
                                                		//  alert('abc');
                                                		    // Allow: backspace, delete, tab, escape, enter and .
                                                		    if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
                                                		         // Allow: Ctrl+A
                                                		        (e.keyCode == 65 && e.ctrlKey === true) || 
                                                		         // Allow: home, end, left, right
                                                		        (e.keyCode >= 35 && e.keyCode <= 39)) {
                                                		             // let it happen, don't do anything
                                                		             return;
                                                		    }
                                                		    // Ensure that it is a number and stop the keypress
                                                		    if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                                                		        e.preventDefault();
                                                		    }
                                                		});
                                                	</script>

</body>
</html>